package com.xdxc.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.*;

@Configuration
public class ThreadPoolConfig {

    @Bean("messageProcessPool")
    public ExecutorService messageProcessPool() {
        return new ThreadPoolExecutor(
                5,      // 核心线程数
                10,     // 最大线程数
                60L, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(1000),
                new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略
        );
    }
}
